import math
def get_consine_scaled_reward(
    min_value_wrong: float = -0.5,
    max_value_wrong: float = -0.1,
    min_value_correct: float = 0.8,
    max_value_correct: float = 1.0,
    max_len: int =1000,
):
    def consine_scaled_reward(completions,solution,accuracy_rewards,**kwargs):
        contents = [completion[0]["content"] for completion in completions]
        rewards = []
        for content,sol,acc_reward in zip(contents,solution,accuracy_rewards):
            gen_len = len(content)
            progress = gen_len / max_len
            cosine = math.cos(progress * math.pi)
            if acc_reward > 0.5:
                min_value = min_value_correct
                max_value = max_value_correct
            else:
                min_value = max_value_wrong
                max_value = min_value_wrong
            reward = min_value + 0.5 *(max_value - min_value) * (1.0 + cosine)
            rewards.append(float(reward))
        return consine_scaled_reward